const PswDao=require("../../dao/psw/psw_dao.js")

const PswService={
	//增加，修改密码信息

// <<<<<<< HEAD
	modify(req,res,next){
		//获取post请求中传递的数据
		/*const{oldpsw,newpsw,turepsw}=req.body;
=======
	modify(res,req,next){
		//获取post请求中传递的数据
		const{oldpsw,newpsw,turepsw}=req.body;
>>>>>>> 79c9b497f3c65895301f80ba782aa12597a0c8a1
            //修改密码
              PswDao.find(oldpsw,newname,turename)                                           
	        if(oldname===oldname&&newname===newname&&turename===turename)
             .then((data)=>{
             	res.json({
             		res_code:1,
             		res_error:"",
             		res_body:{
             			status:1,
             			data:data
             		}

             	});
             })
<<<<<<< HEAD
            .catch((err)=>{
=======
            PswDao.catch((err)=>{
>>>>>>> 79c9b497f3c65895301f80ba782aa12597a0c8a1
             	res.json({
             		res_code:0,
             		res_error:err,
             		res_body:{}
             	})
<<<<<<< HEAD
             });*/

             let username = "aa";
            // console.log(req.body)
             const {newpsw}=req.body;
             // console.log({newpsw})
             // console.log(PswDao)

             PswDao.update(username,{newpsw})
                   .then((data)=>{
                        console.log(data)
                        res.json({
                              res_code:1,
                              res_error:"success",
                              res_body:{
                                    status:1,
                                    data:data
                              }
                        });
                   })
                   .catch((err)=>{
                       res.json({
                         res_code:0,
                         res_error:err,
                         res_body:{}

                       });
                   });
// =======
              }
// >>>>>>> 79c9b497f3c65895301f80ba782aa12597a0c8a1
	
}

module.exports=PswService;